﻿using System;
using System.Data;
using System.Text;
using System.Data.OleDb;
using He.Common;
using System.Data.SQLite;
namespace He.DAL
{
    /// <summary>
    /// 数据访问类:channel
    /// </summary>
    public partial class channel
    {
        #region  Method

        public readonly string TblName = SysKeys.TABLE_PREFIX + "channel";

        /// <summary>
        /// 修改一列数据
        /// </summary>
        public void UpdateField(int id, string strValue)
        {
            DbHelperSQLite.UpdateField(this.TblName, id, strValue);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.channel GetModel(string name)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select * from he_channel ");
            strSql.Append(" where name=@name");
            SQLiteParameter[] parameters = {
					new SQLiteParameter("@name", DbType.String)
			};
            parameters[0].Value = name;

            He.Model.channel model = new He.Model.channel();
            DataSet ds = DbHelperSQLite.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
        #endregion  Method
    }
}

